package com.yunji.common.model.enums;


import com.yunji.common.utils.bean.BeanUtils;

import java.util.Objects;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.common.sms.enums
 * @Title: UploadType
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * 2024-10-14 17:47:10      V1.0        HuaAo       新建类
 */

public enum UploadType {
    LOCAL(0, "本地上传"),
    OSS(1, "OSS上传"),
    MINIO(2, "MinIo上传");

    private final Integer code;
    private final String text;

    UploadType(Integer code, String text) {
        this.code = code;
        this.text = text;
    }

    public Integer getCode() {
        return code;
    }

    public String getText() {
        return text;
    }

    public static String get(Integer code) {
        if (BeanUtils.isNull(code)) {
            return null;
        }
        UploadType[] enums = UploadType.values();
        for (UploadType e : enums) {
            if (Objects.equals(e.code, code)) {
                return e.text;
            }
        }
        return null;
    }
}